package com.maimao.goods.client.factory;

import com.maimao.core.enums.RespCode;
import com.maimao.core.model.resp.Result;
import com.maimao.goods.client.ShopClient;
import com.maimao.goods.client.UploadClient;
import com.maimao.model.user.Shop;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author MaoLin Wang
 * @date 2020/11/30 10:03 下午
 */
@Component
@Slf4j
public class UploadFallBackFactory implements FallbackFactory<UploadClient> {

    @Override
    public UploadClient create(Throwable cause) {
        String errorMsg = cause.getMessage() == null ? "" : cause.getMessage();

        return new UploadClient() {
            @Override
            public void deleteBatch(List<String> urls) {
                log.error("调用[UploadClient-deleteBatch({})]出错 :{}", urls, errorMsg);
            }


        };
    }
}
